// https://www.luogu.com.cn/problem/P5459
// 动态开点值域线段树
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
using ll = long long;
using T = int;
T rad(); // quick read
const ll inf = 1e11;
#define rf(i, n) for (int i = 1; i <= (n); ++i)
const int max_size = 5 + 100;
const int maxn = 5 + 1e5;

struct Seg {
  private:
    int tot;
    ll val[maxn << 5];
    int ch[maxn << 5][2];

    int new_node(int x) { return val[++tot] = x, ch[tot][0] = 0, ch[tot][1] = 0, tot; }
    void maintain(int u) { val[u] = val[ch[u][0]] + val[ch[u][1]]; }

  public:
    int update(int u, ll l, ll r, ll pos, ll x) {
        if (u == 0) u = new_node(0);
        if (l == r) {
            val[u] += x;
            return u;
        }

        ll mid = l + r >> 1;
        if (pos <= mid)
            ch[u][0] = update(ch[u][0], l, mid, pos, x);
        else
            ch[u][1] = update(ch[u][1], mid + 1, r, pos, x);
        maintain(u);
        return u;
    }

    ll ask(int u, ll l, ll r, ll s, ll t) {
        if (u == 0) return 0;
        if (s <= l && r <= t) return val[u];

        ll mid = l + r >> 1;
        if (t <= mid) return ask(ch[u][0], l, mid, s, t);
        if (s > mid) return ask(ch[u][1], mid + 1, r, s, t);
        return ask(ch[u][0], l, mid, s, t) + ask(ch[u][1], mid + 1, r, s, t);
    }
} seg;

int root, n, L, R;
int a[maxn];
ll pre[maxn];

int main() {
    n = rad(), L = rad(), R = rad();
    rf(i, n) a[i] = rad(), pre[i] = pre[i - 1] + a[i];
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        root = seg.update(root, -inf, inf, pre[i - 1], 1);
        ans += seg.ask(root, -inf, inf, pre[i] - R, pre[i] - L);
    }
    printf("%lld", ans);
}

T rad() {
    T back = 0;
    int ch = 0, posi = 0;
    for (; ch < '0' || ch > '9'; ch = getchar())
        posi = ch ^ '-';
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        back = (back << 1) + (back << 3) + (ch & 0xf);
    return posi ? back : -back;
}